package com.adcc.monitoragent.bean;

import com.adcc.monitoragent.util.JsonUtil;



/**
 * ip + port 唯一确定 mongodb 监控信息
 * 
 * @author yycoder
 * 
 */
public class MongoBean extends BaseBean {
	private static final long serialVersionUID = 1L;
	/**
	 * 固定窜
	 */
	private  String fixType = "mongo";
	private String port;// 端口
	public MongoBean() {
		super();
	}

	public MongoBean(String key) {
		super();
		String[] temp = key.split(":");
		if(temp.length == 2) {
			this.ip = temp[0];
			this.port = temp[1];
		}
	}
	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}
	
	
	@Override
	public String toString() {
		return "MongoBean [fixType=" + fixType + ", port=" + port + "]";
	}

	public String getFixType() {
		return fixType;
	}
	
	/**
	 * 获取关键字唯一标识
	 * @return
	 */
	public String buildKey() {
		return this.ip + ":" + this.port;
	}
	
	/**
	 * 获取展现名称   ip+_+port
	 */
	public void setShowName() {
		setShowName("Mongo");
	}
	public static void main(String[] args) {
		MongoBean bean = new MongoBean();
		bean.setIp("192.168.1.1");
		String json = JsonUtil.beanToJson(bean);
		System.out.println(json);
	}
}
